package com.xiaoma.java8.optional;

import java.util.Optional;

public class OptionalMapDemo {

  public static void main(String[] args) {
    String name = "沉默王二";
    Optional<String> nameOptional = Optional.of(name);
    Optional<Integer> intOpt = nameOptional
        .map(String::length);

    System.out.println(intOpt.get());
    System.out.println( intOpt.isPresent());

  }
}
